<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>键盘事件</title>
</head>

<body>






</body>

<script>
    var d = document.body;

    /*   d.onkeyup = function() {
        alert('起飞');
    }
 */
    d.addEventListener('keyup', function() {
        alert('起飞');
    })

    d.addEventListener('keydown', function() {
        alert('掉下');
    })
</script>

</html>